UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sg6d7gu0w5YZBTuarOhC8ZuBNW49+BK5pbZhmVToJxM=' 
WHERE 
  key_id = '601e763ed72adbb54f61ad7aefe22de73f7a310d4b13adf34e07703e90a18c2a' 
  AND (
    token = 'sg6d7gu0w5YZBTuarOhC8ZuBNW49+BK5pbZhmVToJxM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032