UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tEN92nuStYnUEwNboGbqDRj0BefgFlUmVl5l43WLGsA=' 
WHERE 
  key_id = '6869a76e64f7187b059d771a75c29c699805a31f85809ca712f9798b02d8f57a' 
  AND (
    token = 'tEN92nuStYnUEwNboGbqDRj0BefgFlUmVl5l43WLGsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022