UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EVyrafLp9sp/uzQHzawnb9YD+YZmi/QbXhIbsVxFCFE=' 
WHERE 
  key_id = '1edcac047ef4f7abbe066251956b6a342d5f7968c266b4b033469d5685d92226' 
  AND (
    token = 'EVyrafLp9sp/uzQHzawnb9YD+YZmi/QbXhIbsVxFCFE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026