UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HydJ60rOVHd8Za2Sgi+2qDJctJyInY5di9TYm3zNVhM=' 
WHERE 
  key_id = 'e5e5c35c9359efcd22378c846b96d1f0a2c21b1666ceb3bdcd1742e4ef310a06' 
  AND (
    token = 'HydJ60rOVHd8Za2Sgi+2qDJctJyInY5di9TYm3zNVhM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028