UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2kgXyrvwNi9liidh2FDvpWfwBLbTgCoTEpRhnPE3OpY=' 
WHERE 
  key_id = '17a80502003cbdbd36de010053196788f9cb9c3e3b27f9c1033e5150431335fe' 
  AND (
    token = '2kgXyrvwNi9liidh2FDvpWfwBLbTgCoTEpRhnPE3OpY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021