UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rYmM3nFfBEqAQ+dBCOF1U9XgeUM896FSAuzatRyGWpA=' 
WHERE 
  key_id = '1d5a22cf574a84fed981a2db8ade7848a555606ea8b104a74fcde36281ac30fa' 
  AND (
    token = 'rYmM3nFfBEqAQ+dBCOF1U9XgeUM896FSAuzatRyGWpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039