UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sHpy+bmtquPQT2f8tAb156fqBpaaf7KHG0rApdQ2ZaI=' 
WHERE 
  key_id = 'd03ce0a9d90d608024391312cfb1ceb0ced87fe46e42b573b5ad3f1759deb594' 
  AND (
    token = 'sHpy+bmtquPQT2f8tAb156fqBpaaf7KHG0rApdQ2ZaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034