UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8FbcZjwA0cLS9zCv+2YyYlakEc1TQDgIsvpNo97bYq8=' 
WHERE 
  key_id = '12ebd0d29f179cc7182699a8b6e56690aba7432e6e42742ac7222735dad840c2' 
  AND (
    token = '8FbcZjwA0cLS9zCv+2YyYlakEc1TQDgIsvpNo97bYq8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035