UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nhHKBEH1Dn+fG3OCQA5Y6NpO1NhvCoTVV8EBsRmvRIM=' 
WHERE 
  key_id = '311f4c1d02b36a0583d920205004a4fe468999e586bee4d5f9a7db3549c66ac9' 
  AND (
    token = 'nhHKBEH1Dn+fG3OCQA5Y6NpO1NhvCoTVV8EBsRmvRIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016