UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BFiUT53hwTZ7Mo9ZAMq2NIyPcUJ4r4vEWHg7FiiiKfc=' 
WHERE 
  key_id = '5dff614a50eb19205a4bb297a111ffd1eb402ead2ac4803dc7356959ebe29b10' 
  AND (
    token = 'BFiUT53hwTZ7Mo9ZAMq2NIyPcUJ4r4vEWHg7FiiiKfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029