UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Twvxtgo20kRRjDUsrqGOpPhflJedD0bpoE0YQ9R5Bv4=' 
WHERE 
  key_id = '21f661d62a4b0e735d9128edbefdd979860f499ddc0d494e12cf5900f9fa59a9' 
  AND (
    token = 'Twvxtgo20kRRjDUsrqGOpPhflJedD0bpoE0YQ9R5Bv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028