UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kpjOcmNBcEltuw5CfH83myUGq7TgxY0jksLZeqyaW+s=' 
WHERE 
  key_id = 'acd2a0256383037af03364fed3bab215d7b186fad027d239f1522016a549c75d' 
  AND (
    token = 'kpjOcmNBcEltuw5CfH83myUGq7TgxY0jksLZeqyaW+s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028