UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4j0XI95ttwPMqJDlDnyfhTVEgefYaX+uSK1qfJzzyag=' 
WHERE 
  key_id = '6c0355cf68fdfbde8f9d974ad92ede6cc86cc3b2ede09784ade61b8e77fe1d2d' 
  AND (
    token = '4j0XI95ttwPMqJDlDnyfhTVEgefYaX+uSK1qfJzzyag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038