UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cunDcIArwkWo1EQSfKjezTMFMu3TUX0vqFE+JL4UILc=' 
WHERE 
  key_id = 'db3955bfac92897a85f0b28aab342f07f10200c35c661d67f3a3f9e427a8692d' 
  AND (
    token = 'cunDcIArwkWo1EQSfKjezTMFMu3TUX0vqFE+JL4UILc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026