UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E4aBWkB159tvEoFAhf8IQTsPYNytpjU+Zc65MgmFZ/Q=' 
WHERE 
  key_id = '7e6c924d818922a8bd849ee8ebff236fd30579484ee80834fdd885f11dbd967d' 
  AND (
    token = 'E4aBWkB159tvEoFAhf8IQTsPYNytpjU+Zc65MgmFZ/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028