UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'O5bRMzbB+sXFOx9bcgfe6tTiRSA7q7jna6lTYMaPp20=' 
WHERE 
  key_id = '0329c7b0ee8310fbd626831f4714d2e9a04bb840bb411596c5d4b563ab050085' 
  AND (
    token = 'O5bRMzbB+sXFOx9bcgfe6tTiRSA7q7jna6lTYMaPp20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033