UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QgijQl6vI+o++6pg+a8rj+jr7rzm2BuBv0YseoyLvfw=' 
WHERE 
  key_id = '1a1e31b9ec30b42c0cdc85981cb80449f8b5e295d82fec5c9ff0f4ad969f9b57' 
  AND (
    token = 'QgijQl6vI+o++6pg+a8rj+jr7rzm2BuBv0YseoyLvfw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050