UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wPrr+DXifkM1/YpFQG624Ss4wg+6IpiRX9OrJ4SHijI=' 
WHERE 
  key_id = '4c827d034e2fe6e66169286c6c61c6c23d2f50503818f248d3974c9eb66d108f' 
  AND (
    token = 'wPrr+DXifkM1/YpFQG624Ss4wg+6IpiRX9OrJ4SHijI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034