UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NaIBWcpiCluwS5LkZl0mWFq6vs/H1otm8DGpBPNO2l4=' 
WHERE 
  key_id = 'a901232518b1619363824d950a1a0f9165f3e19484456d352beb8123611ad2d4' 
  AND (
    token = 'NaIBWcpiCluwS5LkZl0mWFq6vs/H1otm8DGpBPNO2l4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029