UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tog/6hiiv4b/Tm6HN+vx3aEwxxWKLfXkSsO6V/Ee2mo=' 
WHERE 
  key_id = '21ee485cf01dc75a7717587b4233f7a9aa1685d6269733b1bbc2dd80b8990894' 
  AND (
    token = 'Tog/6hiiv4b/Tm6HN+vx3aEwxxWKLfXkSsO6V/Ee2mo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039