UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k1SXATw3xv7Z+Bk3LvBE3QTpm/QZNARE1BuB0uM2IWc=' 
WHERE 
  key_id = 'b733ea4e17fc5061334598a7957f22c64046db6283c4526cdcd1b4027d267176' 
  AND (
    token = 'k1SXATw3xv7Z+Bk3LvBE3QTpm/QZNARE1BuB0uM2IWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037