UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pGl118NHnbR3FGvuOcNKfF5AOUe2HWlY646i9e0RlWw=' 
WHERE 
  key_id = '0067e8e234539ca7a340684e92bb14643efae704064f39709cdd5c4564b26aa8' 
  AND (
    token = 'pGl118NHnbR3FGvuOcNKfF5AOUe2HWlY646i9e0RlWw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046