UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9ll+SsR5U9Q+IJI3fGKD6SR5Gr+tWXraKXVGcPTYaRs=' 
WHERE 
  key_id = 'e37449bc5780233fcd21c94027632bb496ecb1097739936fbadf4d3f69cc21ac' 
  AND (
    token = '9ll+SsR5U9Q+IJI3fGKD6SR5Gr+tWXraKXVGcPTYaRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051