UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3q3kLEUKLdWxloVhTja10Mm2ILpN1dTUFoudm7pIWbE=' 
WHERE 
  key_id = '083c34bc82bd7f62b9dfc0c09c666465ff154c2ac176b37b321438b27b29cc10' 
  AND (
    token = '3q3kLEUKLdWxloVhTja10Mm2ILpN1dTUFoudm7pIWbE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052