UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6xobEDagYJeuKMdhKV3iZid95QUnMdS7qQBanyj1pM8=' 
WHERE 
  key_id = '8f6a6a6b6da805ffec2459a309acf15dd0bbb560288df12e9b908ba6b2e61e3b' 
  AND (
    token = '6xobEDagYJeuKMdhKV3iZid95QUnMdS7qQBanyj1pM8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064