UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VpNk3vMWnqf6k3wjZHrA9BaXLbnBvEXGY9ZOG9qUa6E=' 
WHERE 
  key_id = 'e7062f277eae5e0461dd27346aa3a33966d6c0abeb198e527a84bd956a3eda60' 
  AND (
    token = 'VpNk3vMWnqf6k3wjZHrA9BaXLbnBvEXGY9ZOG9qUa6E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032