UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HI3I+o9/+EqGNuiiZKWubZLplU32pWx7Oa9Yng9l7SU=' 
WHERE 
  key_id = 'b8c8009a184a56cfe41ffcfabaf4167fe8a776dc091649843bd74e58fc9f1bd0' 
  AND (
    token = 'HI3I+o9/+EqGNuiiZKWubZLplU32pWx7Oa9Yng9l7SU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044