UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DDehaAbe7VI28NdChvCr6UYdeIBgPIgGqW9/94m4pC0=' 
WHERE 
  key_id = 'fd7ccdba327fa2e0b51f048b42c47bd103692ca8a401a26b963846afc65f98ee' 
  AND (
    token = 'DDehaAbe7VI28NdChvCr6UYdeIBgPIgGqW9/94m4pC0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042