UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PDGNWl13WD6PCEeSM9F7wKeeR6bB/2x83JoBXdvNuAM=' 
WHERE 
  key_id = '9bb3176cb0511e3af40fe9a205bb905967545427337c01e4206744728eaaadcc' 
  AND (
    token = 'PDGNWl13WD6PCEeSM9F7wKeeR6bB/2x83JoBXdvNuAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025