UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Va9zx3thlCSg7LR2zfyIxohItNkbzVgutMO2lSVQZRU=' 
WHERE 
  key_id = '354e6fef46f0084656b92f65de2d62148a8b9d04223119b57248e41fe85c881e' 
  AND (
    token = 'Va9zx3thlCSg7LR2zfyIxohItNkbzVgutMO2lSVQZRU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025