UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'alFkBj5+w9gqsdfneWWViMknU8sW7dwVTeqzaxwluw0=' 
WHERE 
  key_id = '8ffe2992138646c2bf4ac433f3009845ce1244ea1177b65ef5b3cce6d691afdc' 
  AND (
    token = 'alFkBj5+w9gqsdfneWWViMknU8sW7dwVTeqzaxwluw0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026