UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T6Zb4qHWAagmte5a7Yq2hpX0Xa9iGZfKP2uNRW1PfRw=' 
WHERE 
  key_id = 'e1cbc6418b624e11af25d6886b6617c57cd9937fa435ddead16b0a6e56f83d82' 
  AND (
    token = 'T6Zb4qHWAagmte5a7Yq2hpX0Xa9iGZfKP2uNRW1PfRw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017