UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PiyMC5pnBI5sX7fI9Vn4zLvl8eNcVMIZdhEVA8E38Zo=' 
WHERE 
  key_id = 'cdc09e99a3589be019a1f91f7bbe80b0ef081b1e53b19c22710fdcd6316f985a' 
  AND (
    token = 'PiyMC5pnBI5sX7fI9Vn4zLvl8eNcVMIZdhEVA8E38Zo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023