UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UWhzXQ709Hpj8H1fiBVcVcUeZf5w94yK9NV6LXoi+ZM=' 
WHERE 
  key_id = '3e4ae7132c1f66d6d51267b3d05acc16869e25bcd170f983bf978f38cd92dc7c' 
  AND (
    token = 'UWhzXQ709Hpj8H1fiBVcVcUeZf5w94yK9NV6LXoi+ZM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019